/*
 *  $Id: Rogue.cs 975 2009-12-16 17:13:22Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Affects {
    /// <summary>
    /// Эффект: вор
    /// При ударе по игроку-противнику выбивает из его рук Х карт.
    /// </summary>
    public class Rogue: Affect {
        public readonly int Cards;

        public Rogue(int cards) {
            Cards = cards;
        }

        public override string Id {
            get { return "rogue"; }
        }
        public override string NameText {
            get { return Name.GetText(Cards); }
        }

        public override int BaseWeight {
            get { return Cards * 30; }
        }

        public override AffectIcon Icon {
            get { return AffectIcon.Rogue; }
        }

        public override Affect Clone() {
            return new Rogue(Cards);
        }

        public override void SetAffect() {
            base.SetAffect();
            LocalSummary.OnHit += DoRogue;
        }
        public override void ResetAffect() {
            base.ResetAffect();
            LocalSummary.OnHit -= DoRogue;
        }

        private void DoRogue(Creature hitter, AbstractObject target, int damage) {
            if (target is Player) {
                Player player = (Player) target;
                player.ReleaseCards(Cards);
            }
        }
    }
}